<include file="public+header">

{script}
<!--
function add(){

	Dyhb.AjaxSubmit('roleAdd','{:G::U('role/insert')}','',complete);
}
function update(){

	Dyhb.AjaxSubmit('roleAdd','{:G::U('role/update')}');
}
function complete(data,status){

    if(status==1){

        $('#id').val(data.id);
    }
}

function ajaxSelect() {

   $("#ajaxSelect").css('display','block');
   var html = $.ajax({
       url: "{:G::U('role/select')}",
       async: false
   }).responseText;

   $("#ajaxSelect").html(html);
}

-->
{/script}

   <!-- 标题  -->
   <div class="title"><if condition="empty( $nId )" ><lang>添加角色</lang><else/><lang>编辑角色</lang></if> ( <a href="{:G::U('role/index')}"><lang>返回角色列表</lang></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<if condition="empty( $nId )" >{:G::U('role/insert')}<else/>{:G::U('role/update')}</if>" method="post" id="roleAdd" name="roleAdd">
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="role_name"><lang>组名</lang>：</label></th>
            <td><input type="text" name="role_name" id="role_name" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['role_name']}</if>"/>
            <br/><div class="description"><lang>角色的名字，比如说领导，员工</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_parentid"><lang>上级组</lang>：</label></th>
            <td><input type="text" name="parentRoleName" id="parentRoleName" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['role_parentid']|getRolenameByid}</if>"/>
            <a href="" onClick="ajaxSelect();return false;" title="<lang>上级组</lang>"><img src="__TMPLPUB__/Images/top.gif"></img></a>
            <br/><div class="description"><lang>父级角色，采用ajax加载选择</lang></div>
            </td>
          </tr>
          <tr class="none" id="ajaxSelect">
          <td><img src="__TMPLPUB__/Images/ajaxloading.gif"></img><lang>数据加载中</lang>...
		  </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_status"><lang>组状态</lang>：</label></th>
            <td><select class="field"  name="role_status">
	             <option value="1" <if condition="isset( $arrValue ) && $arrValue['role_status']==1">selected</if>><lang>启用</lang></option>
	             <option value="0" <if condition="!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['role_status']==0 ) ">selected</if>><lang>禁用</lang></option>
	           </select>
	           <br/><div class="description"><lang>是否启用角色，只有启用的角色才能够使用</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="role_remark"><lang>描述</lang>：</label></th>
            <td><textarea name="role_remark" id="role_remark" class="field" cols="70" rows="5"><if condition="isset( $arrValue )">{$arrValue['role_remark']}</if></textarea>
            <br/><div class="description"><lang>角色相关信息描述</lang></div></td>
          </tr>

          </table>
          <p class="center"><input type="hidden" name="ajax" value="1">
          <input type="hidden" name="role_parentid" id="role_parentid" value="<if condition="isset( $arrValue )">{$arrValue['role_parentid']}</if>">
          <input type="hidden" name="id" id="id" value="<if condition="!empty( $nId )" >{$nId}</if>"/>
         <input type="button" onclick="<if condition="!empty( $nId )" >update()<else/>add()</if>" class="button" value="<if condition="!empty( $nId )" >  <lang>更  新</lang><else/>  <lang>发  布</lang></if>  " />
          <input type="reset" class="button" value="  <lang>重  置</lang>  " />
        </p>
        </form>
   </div>
   <!-- end content -->

<include file="public+footer">